package review.中级算法复习.排序和搜索;

public class No8 {
    public boolean searchMatrix(int[][] matrix,int target){
        int row = 0,col = matrix[0].length-1;

        while (row < matrix.length && col > -1) {
            if (matrix[row][col] == target) {
                return true;
            } else if (matrix[row][col] > target) {
                col--;
            }else{
                row++;
            }
        }

        return false;
    }
}
